package cn.deali.minimalpoem.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import cn.deali.minimalpoem.entity.PoemFavoriteEntity;
import cn.deali.minimalpoem.entity.PoemHistoryEntity;

import cn.deali.minimalpoem.db.PoemFavoriteEntityDao;
import cn.deali.minimalpoem.db.PoemHistoryEntityDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig poemFavoriteEntityDaoConfig;
    private final DaoConfig poemHistoryEntityDaoConfig;

    private final PoemFavoriteEntityDao poemFavoriteEntityDao;
    private final PoemHistoryEntityDao poemHistoryEntityDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        poemFavoriteEntityDaoConfig = daoConfigMap.get(PoemFavoriteEntityDao.class).clone();
        poemFavoriteEntityDaoConfig.initIdentityScope(type);

        poemHistoryEntityDaoConfig = daoConfigMap.get(PoemHistoryEntityDao.class).clone();
        poemHistoryEntityDaoConfig.initIdentityScope(type);

        poemFavoriteEntityDao = new PoemFavoriteEntityDao(poemFavoriteEntityDaoConfig, this);
        poemHistoryEntityDao = new PoemHistoryEntityDao(poemHistoryEntityDaoConfig, this);

        registerDao(PoemFavoriteEntity.class, poemFavoriteEntityDao);
        registerDao(PoemHistoryEntity.class, poemHistoryEntityDao);
    }
    
    public void clear() {
        poemFavoriteEntityDaoConfig.clearIdentityScope();
        poemHistoryEntityDaoConfig.clearIdentityScope();
    }

    public PoemFavoriteEntityDao getPoemFavoriteEntityDao() {
        return poemFavoriteEntityDao;
    }

    public PoemHistoryEntityDao getPoemHistoryEntityDao() {
        return poemHistoryEntityDao;
    }

}
